<template>
    <div>
        <h1>添加</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>Id</td>
                    <td><input type="text" ></td>
                </tr>
                 <tr>
                    <td>名称</td>
                    <td><input type="text" ></td>
                </tr>
                 <tr>
                    <td>价格</td>
                    <td><input type="text" ></td>
                </tr>
                 <tr>
                    <td>面积</td>
                    <td><input type="text" ></td>
                </tr>
                  <tr>
                    <td>入住人数</td>
                    <td><input type="text" ></td>
                </tr>
                 <tr>
                    <td></td>
                    <td><input type="button" value="添加" @click="add"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';

let info:any=ref({
    "id": 0,
    "name": "",
    "price": "",
    "area": "",
    "people": ""
})
const add=()=>{
    if(info.value.name==""){
        alert("名称不能为空")
        return;
    }
    axios({
        url:'https://localhost:7229/api/Hotel/Add',
        method:'post',
       
    })
    .then((res)=>{
        console.log(res);
    })
    .catch((err)=>{
        console.log(err);
    })
}

</script>

<style scoped>

</style>